'''
''' MyPageLoad sub is called when a page is loaded.
'''
''' The object that raised the load event.
''' The object that contains the event data of the load event.
Private Sub MyPageLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Try
If Not Me.IsPostBack Then
Dim DataGrid As System.Web.UI.WebControls.DataGrid
' "myDataGrid" is the id of the asp DataGrid
DataGrid = CType(Me.FindControlRecursively("myDataGrid"), System.Web.UI.WebControls.DataGrid)
If (Not IsNothing(DataGrid)) Then
' example of where clause is
' whereStr = " myNumericField = 1"
' whereStr = " myStrField = '1'"
Dim whereStr as String = Nothing
' Create orderBy clause
Dim orderBy As BaseClasses.Data.OrderBy = Nothing
' Set page index and size
Dim pageIndex as Integer = 0
Dim pageSize as Integer = 1000
' Retrieving first 1000 records.
dataGrid.DataSource = ${${Table Name}ClassName}.GetDataTable(whereStr, orderBy, pageIndex, pageSize)
dataGrid.DataBind()
End If
End If
Catch ex As Exception
' Report error message to the user
Utils.RegisterJScriptAlert(Me, "UNIQUE_SCRIPTKEY", ex.ToString)
End Try
End Sub
|